



import 'package:todo_app/thirdpart/flutter_fms/flutter_fms.dart';
import 'package:todo_app/utils/call/CallHelper.dart';
import 'package:todo_app/utils/call/contexts/ConnectingUIContext.dart';

/// 链接中
class ConnectingState extends IState {

  ConnectingUIContext? context;

  ConnectingState({ this.context });

  @override
  String get name => "ConnectingState";

  @override
  void onEnter(IState? prev) {
    print("===========> 进入链接中");
    if(prev is! ConnectingState) {
      /// 播放音乐
      print("===========> 播放音乐");
      CallHelper.connectingFromState(context?.room);
    }
  }

  @override
  void onExit(IState? next) {
    print("===========> 离开链接中");
    if(next is! ConnectingState) {
      /// 暂停音乐
      print("===========> 暂停音乐");
      CallHelper.disposeConnectingFromState();
    }
  }

  @override
  String get tag => "ConnectingUI";
}